<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>
// ES5新增的数组方法：

// 1.indexOf()用于检索某个元素第一次在数组中出现的索引，返回元素的索引，没有返回-1
// var arr1 = [13,43,25,66,7,24,66];
// var res1 = arr1.indexOf(66);
// console.log( res1 );// 3

// var res2 = arr1.indexOf(88);
// console.log( res2 );// -1

// 2.lastIndexOf()用于检索某个元素最后一次在数组中出现的索引，返回元素的索引，没有返回-1
// var arr1 = [13,43,25,66,7,24,66];
// var res3 = arr1.lastIndexOf(66);
// console.log( res3 );// 6

// var res4 = arr1.lastIndexOf(88);
// console.log( res4 );// -1


// 3.Array.isArray()用于判断某个值是否为数组，返回布尔值
var arr2 = [1,2,3];
var arr3 = {a:123};
console.log( typeof arr2 );// 'object'
console.log( typeof arr3 );// 'object'
console.log( Array.isArray(arr2) );// true
console.log( Array.isArray(arr3) );// false

</script>
</body>
</html>